﻿using HardcoreGame.Common.Players;
using HardcoreGame.Content.Buffs;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace HardcoreGame.Content.Items.Consumables.Others
{
    public class StaminaCrystal : ModItem
    {
        public override void SetStaticDefaults()
        {
            Item.ResearchUnlockCount = 10;
        }
        public override void SetDefaults()
        {
            Item.buffType = ModContent.BuffType<Athletic>();
            Item.buffTime = 7200;
            Item.maxStack = Item.CommonMaxStack;
            Item.consumable = true;
            Item.width = 14;
            Item.height = 36;
            Item.useStyle = ItemUseStyleID.HoldUp;
            Item.useTime = 30;
            Item.UseSound = SoundID.Item4;
            Item.useAnimation = 30;
            Item.rare = ItemRarityID.Green;
            Item.value = 75000;
        }
        public override bool CanUseItem(Player player)
        {
            player.AddBuff(ModContent.BuffType<Athletic>(), 7200, true);
            Item.stack--;
            player.GetModPlayer<StaminaPlayer>().Logic.AddStamina(player, 100f);
            return base.CanUseItem(player);
        }
    }
}
